package com.book.common;

public enum OrderStatusEnum {

    ORDER_STATUS_FINISH(1, "已完成"),
    ORDER_STATUS_CANCEL(2, "已取消"),
    ORDER_STATUS_WAIT(0, "待完成");


    private Integer code;
    private String msg;

    OrderStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    private Integer code() {
        return code;
    }

    public static String getMsg(Integer code) {
        OrderStatusEnum[] orderStatusEnums = values();
        for (OrderStatusEnum o : orderStatusEnums
        ) {
            if (o.code.equals(code)){
                return o.msg;
            }
        }
        return null;
    }
}
